package supremeragcalc.util.gui;

import java.awt.Color;
import java.awt.Image;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import javax.imageio.ImageIO;

public class GenericImage  {
	
	/**
	 * This class basically is a reader of bmp image files.
	 * For general purposes this class implement a ColorMask 
	 * (color: pink, RGB: 255,0,255 #ff00ff), standart to this application
	 */
	
	private Image image = null;
	
	public GenericImage(String imgpath) {
		try {
			image = ImageIO.read(new FileInputStream(imgpath));
			Image tmp = ColorMask.applyMask(image, new Color(255,0,255)); //Pink
			image = tmp;

		} catch (FileNotFoundException e) {
			//e.printStackTrace();
			
		} catch (IOException e) {
			System.out.println("Load image error: " + imgpath + ": " + e);
			e.printStackTrace();
		}
	}
	
	public Image getImage() {
		return image;
	}
	
	public int getWidth() {
		return getImage().getWidth(null);
	}
	
	public int getHeigth() {
		return getImage().getHeight(null);
	}
}
